let list = [
  {
    id: 1,
    dictName: '首席运营师',
    dictCode: 'CET',
    status: '1',
    remark: 'New York No. 1 Lake Park',
  },
]

const listData = {
  'one': [
    {
      id: 1,
      label: '正常',
      value: 'normal',
      status: '1',
      remark: 'New York No. 1 Lake Park',
    },
    {
      id: 2,
      label: '关闭',
      value: 'closed',
      status: '1',
      remark: 'New York No. 1 Lake Park',
    },
  ]
}

export default {
  'GET  /api/v1/dict': {
    data: list,
    total: list.length,
    page: 1,
    success: true
  },
  'GET  /api/v1/dict/1': {
    id: 1,
    dictName: '首席运营师',
    dictCode: 'CET',
    status: '1',
    remark: 'New York No. 1 Lake Park',
  },
  'POST /api/v1/dict/': async (req: Request, res: Response) => {
    const { dictName, dictCode, status, remark } = req.body as any;

    list.push({
      id: list.length + 1,
      dictName,
      dictCode,
      status,
      remark,
    })
    res.send({
      success: true
    });
  },
  'PUT /api/v1/dict/1': async (req: Request, res: Response) => {
    const { dictName, dictCode, status, remark } = req.body as any;

    const one = list.find(l => l.id === 1)
    if (one) {
      one.dictName = dictName
      one.dictCode = dictCode
      one.status = status
      one.remark = remark

    }
    res.send({
      success: true,
      one
    });
  },
  'DELETE /api/v1/dict/1': async (req: Request, res: Response) => {

    list = list.filter((l) => l.id != 1)
    res.send({
      success: true,
    });
  },
  'GET  /api/v1/dict/1/data': {
    data: listData.one,
    total: listData.one.length,
    page: 1,
    success: true
  },
};

